<style>
    .welcome .layui-card {border:1px solid #f2f2f2;border-radius:5px;}
    .welcome .icon {margin-right:10px;color:#1aa094;}
    .welcome .icon-cray {color:#ffb800 !important;}
    .welcome .icon-blue {color:#1e9fff !important;}
    .welcome .icon-tip {color:#ff5722 !important;}
    .welcome .layuimini-qiuck-module {text-align:center;margin-top:10px}
    .welcome .layuimini-qiuck-module a i {display:inline-block;width:100%;height:60px;line-height:60px;text-align:center;border-radius:2px;font-size:30px;background-color:#F8F8F8;color:#333;transition:all .3s;-webkit-transition:all .3s;}
    .welcome .layuimini-qiuck-module a cite {position:relative;top:2px;display:block;color:#666;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px;}
    .welcome .welcome-module {width:100%;height:210px;}
    .welcome .panel {background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
    .welcome .panel-body {padding:10px}
    .welcome .panel-title {margin-top:0;margin-bottom:0;font-size:12px;color:inherit}
    .welcome .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top:.3em;}
    .welcome .layui-red {color:red}
    .welcome .main_btn > p {height:40px;}
    .welcome .layui-bg-number {background-color:#F8F8F8;}
    .welcome .layuimini-notice:hover {background:#f6f6f6;}
    .welcome .layuimini-notice {padding:7px 16px;clear:both;font-size:12px !important;cursor:pointer;position:relative;transition:background 0.2s ease-in-out;}
    .welcome .layuimini-notice-title,.layuimini-notice-label {padding-right:70px !important;text-overflow:ellipsis !important;overflow:hidden !important;white-space:nowrap !important;}
    .welcome .layuimini-notice-title {line-height:28px;font-size:14px;}
    .welcome .layuimini-notice-extra {position:absolute;top:50%;margin-top:-8px;right:16px;display:inline-block;height:16px;color:#999;}
</style>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main welcome">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md12">
                            
                                <div class="layui-row" style="padding-top: 20px">
                                    <div class="layui-col-md4">
                                        <label class="layui-form-label" style="padding-left: 300px;">输入框</label>
                                    </div>
                                    <div class="layui-col-md4">
                                        <input type="text" name="title" required  lay-verify="required" placeholder="请输入用户属性信息" autocomplete="off" class="layui-input" id="info">
                                    </div>
                                    <div class="layui-col-md4">
                                        <div style="padding-left: 180px;">
                                            <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="clickSearch1()">立即提交</button>
                                        </div>
                                        
                                    </div>

                                </div>                            
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-col-md4" style="background-color:#fff;height: 760px;width: 100%;">

            <div class="layui-row" style="width: 100%; height: 100%;">
                <div class="layui-col-md6" style="width: 100%; height: 100%;" id="echarts-pie">
                </div>
            </div>
        
        
        </div>
    </div>
    
</div>
<script>
    layui.use(['layer','echarts'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            echarts = layui.echarts;

        //初始化数据
        let data1 = {
            "brandList":['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine'],
            "monthList":['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            "dataList":[[120, 132, 101, 134, 90, 230, 210],[220, 182, 191, 234, 290, 330, 310],[150, 232, 201, 154, 190, 330, 410],[820, 932, 0, 934, 1290, 1330, 1320]]
        }
        
        //初始化容器
        var echartsPies = echarts.init(document.getElementById('echarts-pie'), 'walden');

        $(function(){
            setData2Option(data1)
        })

        /**
         * 玫瑰图表
         */
        
        function setData2Option(vo) {
            var optionPies =
            {
            title: {
                text: '品牌受欢迎程度程度'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
                }
            },
            legend: {
                data: vo.brandList   //['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
            },
            toolbox: {
                feature: {
                saveAsImage: {}
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                type: 'category',
                boundaryGap: false,
                data: vo.monthList            //['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                }
            ],
            yAxis: [
                {
                type: 'value'
                }
            ],
            series: [
                {
                name: 'Email',
                type: 'line',
                stack: 'Total',
                areaStyle: {},
                emphasis: {
                    focus: 'series'
                },
                data: vo.dataList[0]             //[120, 132, 101, 134, 90, 230, 210]
                },
                {
                name: 'Union Ads',
                type: 'line',
                stack: 'Total',
                areaStyle: {},
                emphasis: {
                    focus: 'series'
                },
                data: vo.dataList[1]             //[220, 182, 191, 234, 290, 330, 310]
                },
                {
                name: 'Video Ads',
                type: 'line',
                stack: 'Total',
                areaStyle: {},
                emphasis: {
                    focus: 'series'
                },
                data: vo.dataList[2]         //[150, 232, 201, 154, 190, 330, 410]
                },
                {
                name: 'Direct',
                type: 'line',
                stack: 'Total',
                areaStyle: {},
                emphasis: {
                    focus: 'series'
                },
                data: vo.dataList[3]         //[320, 332, 301, 334, 390, 330, 320]
                }
            ]
            };


        echartsPies.setOption(optionPies);
        }



        window.clickSearch1 = function(){
            var info = document.getElementById("info").value
            if(info == null || info == ''){
                alert("输入不合法!")
            }
            else{
                var search = info.trim();
                $.ajax({
                    type: "GET",
                    url: "http://localhost:8080/product/moreinfo/"+search,     //1.515915625441994e+18
                    data: null,
                    //dataType: "json",
                    success: function (tmp) { 
                        setData2Option(tmp)
                    }
                })
            }
        }






        // echarts 窗口缩放自适应
        window.onresize = function () {
            echartsRecords.resize();
        }

    });
</script>

   